package com.wgts.wgts.mvp.view.activity.newpeople;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.wgts.wgts.R;

import java.util.ArrayList;

public class NewPeopleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {


    private static final int TITLE = 0x00001;
    private static final int HOLDER = 0x00002;

    private Context context;

    private ArrayList<String> srcData;

    public NewPeopleAdapter(Context context, ArrayList<String> srcData) {
        this.context = context;
        this.srcData = srcData;
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {

        if(i == TITLE){
            return new TitleViewHolder(LayoutInflater.from(context).inflate(R.layout.new_people_title_view_holder, viewGroup, false));
        }

        return new NewPeopleViewHolder(LayoutInflater.from(context).inflate(R.layout.new_people_view_holder, viewGroup, false));
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
        if(viewHolder instanceof NewPeopleViewHolder){

        }else if(viewHolder instanceof TitleViewHolder){

        }
    }


    @Override
    public int getItemCount() {
        return srcData.size();
    }

    @Override
    public int getItemViewType(int position){
        if(isTitle(position)){
            return TITLE;
        }
        return HOLDER;
    }

    public class NewPeopleViewHolder extends RecyclerView.ViewHolder {

        public NewPeopleViewHolder(@NonNull View itemView) {
            super(itemView);
        }
    }

    public class TitleViewHolder extends RecyclerView.ViewHolder {
        public TitleViewHolder(@NonNull View itemView) {
            super(itemView);
        }
    }

    private boolean isTitle(int postion){
        if(postion == 0){
            return true;
        }
        return false;
    }

    private boolean isHolder(int postion){
        if(postion > 1){
            return true;
        }
        return false;
    }


}
